package uinv.com.uitl;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class writeFile
{
  public writeFile(String data, String filePath)
  {
    try
    {
      File file = new File(filePath);

      if (!file.exists()) {
        file.createNewFile();
      }

      FileOutputStream writerStream = new FileOutputStream(filePath);    
      BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(writerStream, "UTF-8")); 
      writer.write(data);
      writer.close();
      
      //System.out.println("-------------------------");
      System.out.println("Generate new files !");
      System.out.println("-------------------------");
    }
    catch (IOException e) {
    	System.out.println("File write failure !");
        System.out.println("-------------------------");
    	//e.printStackTrace();
    }
  }
}
